#include<iostream>
#include<string.h>
using namespace std;
int i=0;
int IsWord(char ch) 
{
	if(ch==','||ch=='.'||ch==' '||ch=='?'||ch=='!')
	     return 1;
	return 0;
}
int main()
{
	char s[100]="";
	gets(s);
	while(s[i]!='\0')
	{
		while(IsWord(s[i])==1&&s[i]!='\0')
		    i++;
		int a=i;
		while(IsWord(s[i])==0&&s[i]!='\0')
		    i++;
		int b=i-1;
		while(a<b)
		{
			char t=s[a];
			s[a]=s[b];
			s[b]=t;
			a++;
			b--;
		}
	    
    
	}for(int j=0;j<strlen(s);j++)
	        cout<<s[j];
	return 0;
}
